#include <./translate.h>

std::string translate(std::string code)
  std::istringstream isstream;
  std::ostringstream osstream;
  isstream.str(code)

  quex::depythonize_c_lex qlex(&isstream)

  std::vector<quex::Token> tokens_before_token
  std::vector<quex::Token> tokens_before_tokenNext

  quex::Token  token
  quex::Token  tokenNext

  //Loop. Starts in program mode
  get_token(token,qlex,tokens_before_token)
  get_token(tokenNext,qlex,tokens_before_tokenNext)
  
  while( token.type_id() != QUEX_TKN_TERMINATION )
    program_mode     (osstream,qlex,token,tokenNext, tokens_before_token, tokens_before_tokenNext)
    preprocessor_mode(osstream,qlex,token,tokenNext, tokens_before_token, tokens_before_tokenNext)
  
  //Write the non compilable tokens before the End Of File
  write_out(osstream,tokens_before_token)

  osstream.flush()

  return osstream.str()

//--helper--